package com.chenyongjing.design.pattern.chain.auth.optimize;

import com.chenyongjing.design.pattern.chain.auth.Member;
import org.springframework.util.StringUtils;

/**
 * @Author chen
 * @Date 2022/11/17 21:34
 */
public class MemberService {
    public void login(String loginName,String loginPass){
        Handler validateHandler = new ValidateHandler();
        Handler loginHandler = new LoginHandler();
        Handler authHandler = new AuthHandler();

        validateHandler.nextHandler(loginHandler);
        loginHandler.nextHandler(authHandler);

        validateHandler.doHandler(new Member(loginName,loginPass));

    }


    private Member checkExists(String loginName, String loginPass) {
        Member member = new Member(loginName,loginPass);
        member.setRoleName("管理员");
        return member;
    }
}
